function PrimaryStudent(props) {
    Student.call(this, props);
    this.grade = props.grade || 1;
}
// 空函数F:
function F() {
}

// 把F的原型指向Student.prototype:
F.prototype = Student.prototype;

// 把PrimaryStudent的原型指向一个新的F对象，F对象的原型正好指向Student.prototype:
PrimaryStudent.prototype = new F();
/**
 * 
 function createObj(o) {
     function F() { }
     F.prototype = o
     return new F()
 }
 * 
 */
/***
 * 
 PrimaryStudent.prototype = Object.create(Student.prototype)
 */
// 把PrimaryStudent原型的构造函数修复为PrimaryStudent:
PrimaryStudent.prototype.constructor = PrimaryStudent;




// -----test
// 继续在PrimaryStudent原型（就是new F()对象）上定义方法：
PrimaryStudent.prototype.getGrade = function () {
    return this.grade;
};



// -----
function Person(name) {
    this.name = name
}
Person.prototype.walk = function () {
    console.log(this.name);
}

function Ming(sex) {
    Person.call(this, "ming")
    this.sex = sex
}
function F() { }
Ming.prototype = new Person()
// F.prototype = Person.prototype
// Ming.prototype = new F()
// Ming.prototype = Object.create(Person.prototype)
Ming.prototype.constructor = Ming;

let p = new Person('wang')
let m = new Ming("male")

console.log(m.walk());

class Per {
    constructor(name, age) {
        this.name = name;
        this.age = age;
    }
    showName() {
        console.log("sdfdsf");
    }
}
class Stu extends Per {
    constructor(name, age, score) {
        super(name, age)
        this.score = score
    }
}
let s1 = new Stu("w", 11, 110)
console.log(s1.showName());